From: Andrew Cooper Date: Fri, 29 Jun 2018 13:05:52 +0000 (+0000) Subject: libx86: Introduce lib/x86/msr.h and share msr_policy with userspace X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~3569 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22man:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22man:/?a=commitdiff_plain;h=2e2bd5a29e481d0e7f163a19d663d959e09550fd;p=xen.git libx86: Introduce lib/x86/msr.h and share msr_policy with userspace To facilitate the shared Xen and toolstack code in libx86, struct msr_policy needs to be available in the same way as struct cpuid_policy. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu Reviewed-by: Roger Pau Monné Acked-by: Jan Beulich --- diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 483b1328e4..5a5b15f43c 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -33,6 +33,7 @@ enum { }; #include +#include #define bitmaskof(idx) (1u << ((idx) & 31)) #define featureword_of(idx) ((idx) >> 5) diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h index 9b4e4e07f1..72342b77b8 100644 --- a/xen/include/asm-x86/msr.h +++ b/xen/include/asm-x86/msr.h @@ -8,6 +8,9 @@ #include #include #include + +#include + #include #include @@ -257,26 +260,6 @@ static inline void wrmsr_tsc_aux(uint32_t val) } } -/* MSR policy object for shared per-domain MSRs */ -struct msr_policy -{ - /* - * 0x000000ce - MSR_INTEL_PLATFORM_INFO - * - * This MSR is non-architectural, but for simplicy we allow it to be read - * unconditionally. CPUID Faulting support can be fully emulated for HVM - * guests so can be offered unconditionally, while support for PV guests - * is dependent on real hardware support. - */ - union { - uint32_t raw; - struct { - uint32_t :31; - bool cpuid_faulting:1; - }; - } plaform_info; -}; - extern struct msr_policy raw_msr_policy, host_msr_policy, hvm_max_msr_policy, diff --git a/xen/include/xen/lib/x86/msr.h b/xen/include/xen/lib/x86/msr.h new file mode 100644 index 0000000000..e6b13ad8cb --- /dev/null +++ b/xen/include/xen/lib/x86/msr.h @@ -0,0 +1,35 @@ +/* Common data structures and functions consumed by hypervisor and toolstack */ +#ifndef XEN_LIB_X86_MSR_H +#define XEN_LIB_X86_MSR_H + +/* MSR policy object for shared per-domain MSRs */ +struct msr_policy +{ + /* + * 0x000000ce - MSR_INTEL_PLATFORM_INFO + * + * This MSR is non-architectural, but for simplicy we allow it to be read + * unconditionally. CPUID Faulting support can be fully emulated for HVM + * guests so can be offered unconditionally, while support for PV guests + * is dependent on real hardware support. + */ + union { + uint32_t raw; + struct { + uint32_t :31; + bool cpuid_faulting:1; + }; + } plaform_info; +}; + +#endif /* !XEN_LIB_X86_MSR_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */